Skip to content

feat: merge ReadMediaFile into Read and remove image cropping - #5405

Open
7Sageer wants to merge 8 commits into
mainfrom
feat/merge-read-media-into-read
Open

7Sageer wants to merge 8 commits into
mainfrom
feat/merge-read-media-into-read

Conversation

@7Sageer

@7Sageer 7Sageer commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Requirement or Bug

此前文件读取拆分为 Read(仅文本)与 ReadMediaFile(图片与视频)两个工具,模型与用户需要区分两套重叠的文件读取入口,同时 ReadMediaFile 内置的 region / full_resolution 图片裁剪逻辑增加了工具参数复杂度与维护负担。本 PR 将图片与视频读取合并进 Read 并下线独立的 ReadMediaFile 工具及内置图片裁剪功能,同时保留存量旧会话的恢复与回放兼容,在恢复含旧版 ReadMediaFile 的会话时注入一次性迁移提醒,并在会话中途切换模型多模态能力时通过 <system-reminder> 提醒模型。

Bug Reproduction Steps

N/A

Root Cause

N/A

Code Changes

核心思路

将原先散落在 ReadMediaFileTool 与动态工具注册器中的图片压缩、视频引用生成、模态能力校验收拢进 ReadTool,让 Read 成为文本、图片、视频的唯一内置文件读取工具,并删除 cropImageForModel(region / full_resolution 参数与 image_crop 遥测)。由于 Read 现在常驻注册而不再随模型能力动态挂载/卸载,新增 AgentMediaCapabilityReminderService 在会话发生多模态能力切换时注入 <system-reminder>;对于升级前写入的旧会话,AgentToolSelectService 与 mediaPolicy 负责剔除已下线的 ReadMediaFile 声明、将旧版 Read schema 刷新为当前定义、在首轮注入一次性 legacy_read_media_merged <system-reminder> 说明工具合并与裁剪参数移除,并保留残留调用拦截与历史记录兜底;Web/Desktop 与 TUI 则根据 Read 输出中的媒体标签将其渲染为媒体卡片与摘要,同时继续支持旧会话中的 ReadMediaFile 回放。

结构图

flowchart TD
    Call["模型调用 Read(path)"] --> Detect{"detectFileType 嗅探类型"}
    Detect -- "UTF-8 / UTF-16 文本" --> TextPath["文本分页与编码读取"]
    Detect -- "图片 / 视频" --> CapCheck{"模型支持对应模态?"}
    CapCheck -- "否" --> CapErr["返回模态能力不足错误"]
    CapCheck -- "是" --> MediaPipe["校验参数与 100MB 上限 -> 压缩并写入 ISessionMediaStore -> 输出媒体标签与 ContentPart[]"]
    MediaPipe --> UI["app-core / TUI 渲染媒体卡片"]
    ModelSwitch["模型模态能力切换"] --> CapReminder["AgentMediaCapabilityReminderService 注入 media_capability 提醒"]
    LegacyResume["恢复旧会话"] --> ToolSelect["AgentToolSelectService 剔除死工具 + 刷新 Read schema + 首轮注入 legacy_read_media_merged 提醒 + 拦截误调用"]
Loading

这样组织是因为文件访问权限、工作区边界、环境代际校验和 daemon-file:// 附件源本来就在 ReadTool 中维护,把媒体读取收拢到同一处后无需再跨动态注册器同步工具生命周期,也消除了按模型切换动态增删工具对上下文前缀稳定性的干扰。

关键决策

决策 选择 没选 理由
跨模型模态切换提示机制 Read 常驻注册,模型在多模态与纯文本间切换时由 AgentMediaCapabilityReminderService 注入 media_capability <system-reminder> 像旧 ReadMediaFile 一样按工具名隐藏历史 Read 调用 Read 同时承载文本和媒体读取,按工具名剥离会误删文本文件读取历史;底层协议的 createMediaDegradeRecovery 与 mediaResolverService 已会将不支持的媒体 ContentPart 降级为文本提示,配合 reminder 即可让模型清楚当前 Read 可读的模态范围。
旧会话恢复时的 Read schema 处理 剔除已注销的 ReadMediaFile,直接将旧版 Read 声明刷新为当前版本的新 schema 保留旧版冻结的 Read schema 并用提示词纠正 我们只承诺同版本 resume 的缓存一致性而不承诺跨版本一致,且剔除顶层 tools[] 中的 ReadMediaFile 本身已击穿全量前缀缓存;保留过时的 Read schema 既无缓存收益,又会让工具描述与真实能力矛盾。直接刷新 Read schema 更简洁,同时同版本 resume 字节完全不变。
旧会话恢复时的迁移提醒 保留 schema 刷新与误调拦截,同时在恢复含 ReadMediaFile 的旧会话首轮注入一次性 legacy_read_media_merged <system-reminder>;compaction 丢弃后仅当历史仍保留 ReadMediaFile 调用时重注入 只靠刷新 Read schema + 误调 ReadMediaFile 时返回错误引导 实测恢复含历史 ReadMediaFile 调用的旧会话时,原生 function calling 模型不会发出未在 tools[] 中声明的调用,误调拦截不会触发;模型反而因「历史里调过 ReadMediaFile 但当前工具列表里没有」而困惑,出现承诺下次继续用 ReadMediaFile、误以为自己发出的 Read 调用是被系统改写等幻觉。一次性提醒直接解释工具下线原因,且不向新会话、同版本恢复或初始工具不含 ReadMediaFile 的旧会话注入噪音。
Read 图片压缩字节预算 维持现有 READ_IMAGE_BYTE_BUDGET = 256 KB(仍可通过 KIMI_IMAGE_READ_BYTE_BUDGET 调整) 在合并时顺带调高默认字节预算 保持本次改动聚焦于工具合并与移除裁剪,不混入默认上下文体积变化。

阅读指南

  1. packages/agent-core-v2/src/agent/tools/os/read/readTool.ts(及 read.ts、read.md):看 Read 如何分流文本与图片/视频读取、校验分页参数与模型模态能力、执行图片压缩并生成 <image|video path="..."> 输出。
  2. packages/agent-core-v2/src/agent/media/image-compress.ts:看移除 cropImageForModel 后的图片压缩链路与更新后的外部裁剪提示语。
  3. packages/agent-core-v2/src/agent/media/mediaCapabilityReminderService.ts:看模型多模态能力发生切换或旧媒体会话恢复到受限模型时,如何按需注入 media_capability <system-reminder> 且避免常规首轮噪音。
  4. packages/agent-core-v2/src/agent/toolSelect/toolSelectService.ts 与 packages/agent-core-v2/src/agent/loop/mediaPolicy.ts:看旧会话恢复时如何过滤已下线的 ReadMediaFile、刷新旧版 Read schema、注入一次性 legacy_read_media_merged 迁移提醒(含 compaction 后的重注入条件)、拦截残留误调用并兼容历史 ReadMediaFile 消息对。
  5. packages/app-core/src/client/toolCalls.ts、apps/kimi-code/src/tui/components/messages/{read-group,tool-call}.ts、apps/kimi-code/src/tui/utils/transcript-items.ts 与 apps/kimi-code/src/tui/components/messages/tool-renderers/{media,chip,summary}.ts:看 Web/Desktop 与 TUI(含并行 ReadGroupComponent 与探索折叠摘要)如何把媒体类 Read 结果路由到媒体卡片/摘要渲染并保留历史 ReadMediaFile 展示。

其余改动为机械清理与同步:删除 src/agent/tools/read-media-file/* 与 src/agent/media/{mediaTools,mediaToolsRegistrar,registerMediaTools}.ts、将 createVideoUploader 移至 videoUpload.ts、从内置 profile 和默认放行策略中移除 'ReadMediaFile'、重生成 state-manifest.d.ts,以及同步更新测试与中英文文档。

代码变更大纲

 packages/agent-core-v2/src/agent/
 ├── tools/
 │   ├── os/read/
 │   │   ├── read.ts / read.md              # 扩展工具描述与 MAX_MEDIA_BYTES 常量
 │   │   └── readTool.ts                    # 合入图片/视频嗅探、能力校验、压缩与附件写入
-│   └── read-media-file/*                  # 删除独立 ReadMediaFile 工具与裁剪参数
 ├── media/
 │   ├── image-compress.ts                  # 删除 cropImageForModel 与裁剪类型
 │   ├── videoUpload.ts                     # 承接 createVideoUploader 与上传遥测
+│   ├── mediaCapabilityReminder.ts         # 多模态能力切换 reminder 服务接口
+│   ├── mediaCapabilityReminderService.ts  # 监听模型能力变化并注入 media_capability 提醒
-│   └── mediaTools*.ts / registerMediaTools.ts
 └── toolSelect/
     └── toolSelectService.ts               # 旧会话剔除 ReadMediaFile、刷新旧版 Read schema、注入一次性迁移提醒并引导误调用
 ReadTool.executeSource(source, args, signal)
   head = source.readFileHead(MEDIA_SNIFF_BYTES)
   fileType = detectFileType(source.name, head.bytes, 'media')
   if fileType.kind === 'image' || fileType.kind === 'video'
-    return error("Use ReadMediaFile to read this file")
+    assert model supports image_in / video_in
+    reject text pagination params (line_offset, column_offset, n_lines, max_chars)
+    enforce 0 < size <= 100MB and READ_IMAGE_BYTE_BUDGET / MAX_IMAGE_EDGE_PX
+    compress image if needed, store in ISessionMediaStore with AbortSignal
+    return [<image|video path="...">, mediaPart, </image|video>] + metadata note

Behavior Changes and Affected Users

行为 改动前 改动后 依赖旧行为的人群 退路(Escape hatch)
读取图片与视频文件的内置工具入口 模型支持 image_in / video_in 时额外注册 ReadMediaFile;Read 遇到图片/视频报错并引导调用 ReadMediaFile Read 直接读取文本、图片与视频(上限 100MB);不再注册独立的 ReadMediaFile 工具 在自定义 agent profile(tools / exclude_tools)、权限审批规则、[tools] 配置、外部 skill/prompt 或自定义脚本中显式指定 ReadMediaFile 的 TUI、print 模式、Desktop/Web、VS Code、ACP 与 SDK 用户 无恢复独立 ReadMediaFile 工具的开关(统一改用 Read,请维护者在本 PR 确认移除);恢复旧版持久化的会话时会自动过滤 ReadMediaFile、将 Read 声明刷新为新版 schema、注入一次性迁移提醒,并对残留调用返回改用 Read 的明确引导
内置图片局部裁剪参数(region 与 full_resolution)及 image_crop 遥测 ReadMediaFile 支持传入 region: { x, y, width, height } 与 full_resolution 在工具内部裁剪大图局部并上报 image_crop 事件 移除内置裁剪能力、region / full_resolution 参数与 image_crop 遥测;向媒体文件传入文本分页参数(line_offset / column_offset / n_lines / max_chars)会明确报错仅适用于文本文件 依赖模型直接通过工具参数裁剪超高分辨率截图细节的所有端多模态用户,以及消费内部 image_crop 遥测事件的看板 无内置参数退路(请维护者在本 PR 确认移除);模型可按压缩说明通过 Bash 调用外部工具(如 Python PIL / ImageMagick)裁剪副本后再调用 Read,或由用户通过环境变量 KIMI_IMAGE_READ_BYTE_BUDGET / KIMI_IMAGE_MAX_EDGE_PX 放宽预算
同一会话跨模型切换 image_in / video_in 能力时的行为 切到纯文本模型时动态卸载 ReadMediaFile,并由 hideReadMediaFile 隐藏历史 ReadMediaFile 调用对 Read 保持注册;会话中途发生模态能力变化(或含历史媒体的旧会话在受限模型上恢复)时注入 media_capability <system-reminder>;不支持对应模态时对媒体调用 Read 返回明确的能力缺失错误(如模型仅支持图片不支持视频时提示 Only text and image files can be read.);旧会话中的 ReadMediaFile 历史消息仍由 hideReadMediaFile 隐藏 在会话中途通过 /model 或配置切换多模态与纯文本模型的 TUI、Desktop/Web、VS Code、ACP 用户 切回具备 image_in / video_in 能力的模型即可继续读取对应媒体
新增提示词提醒 legacy_read_media_merged(AgentToolSelectService) 恢复含 ReadMediaFile 的旧会话时仅静默剔除工具声明并刷新 Read schema,不向模型解释历史 ReadMediaFile 调用的去向 恢复后的首轮注入 <system-reminder>:Tool "ReadMediaFile" has been retired and merged into "Read" in this version. Any earlier "ReadMediaFile" calls in this session are from an older version; do not call "ReadMediaFile" again. Call Read with { "path": "..." } to read text, image, and video files when the current model supports the modality. The "region" and "full_resolution" parameters are no longer supported.;compaction 丢弃该提醒后,仅当历史仍保留 ReadMediaFile 调用时重注入 恢复升级前写入且初始工具包含 ReadMediaFile 的会话的 TUI、print 模式、Desktop/Web、VS Code、ACP 与 SDK 用户(新会话、同版本恢复及初始工具不含 ReadMediaFile 的旧会话不注入) 无开关(一次性迁移说明,不改变工具执行语义;全量压缩清除旧调用后不再注入)
删除提示词文件 packages/agent-core-v2/src/agent/tools/read-media-file/read-media.md 向具备 image_in / video_in 能力的会话(含默认 profile、Plan 模式、Tower worker)提供 ReadMediaFile 工具描述、100MB 限制说明及 region / full_resolution 像素坐标指引 文件整体删除;100MB 媒体读取说明迁入 read.md,裁剪坐标指引随裁剪功能下线移除 所有绑定多模态模型的会话 媒体文件读取约束由 read.md 与 ReadTool.readMedia 运行时校验承接;裁剪能力已移除
修改提示词 packages/agent-core-v2/src/agent/tools/os/read/read.md 首句与附件段 首句为 Read a UTF-8 or UTF-16 text file from the active environment's filesystem, or a kimi-file:// attachment of this session.,附件段含 ReadMediaFile accepts the same reference for images and videos.(约束模型用 ReadMediaFile 读取图片与视频) 首句改为 Read a UTF-8 or UTF-16 text file, an image, or a video file from the active environment's filesystem, or a kimi-file:// attachment of this session.,附件段移除 ReadMediaFile 引用(引导所有会话的模型统一用 Read 读取文本、图片和视频) 所有启用 Read 工具的会话(默认 profile、Plan 模式、Tower worker、自定义 agent) 无(符合合并后的真实工具契约;模型不支持对应模态时由 ReadTool.readMedia 返回能力缺失错误约束)
修改提示词 packages/agent-core-v2/src/agent/tools/os/read/read.md 路径直读、分页与媒体说明 仅对文本文件要求直接 Read、输出 <line-number>\t<content>,无媒体说明 路径直读覆盖所有文件;输出说明改为 Text output / Text results;新增 - Image and video files are supported up to ${MAX_MEDIA_MEGABYTES}MB when the current model supports the corresponding input modality. After generating or editing media via commands or scripts, read the result back before continuing. 所有启用 Read 工具的会话 同时由 ReadTool.readMedia 对分页参数、100MB 大小、模态能力与二进制 NUL 字节做硬性运行时校验
修改提示词说明 packages/agent-core-v2/src/agent/media/image-compress.ts(buildImageCompressionCaption) 用户粘贴或上传的大图被压缩时,提示模型可用 ReadMediaFile 搭配 region 查看原图路径局部 提示原图路径,并说明如需查看细节可用外部工具裁剪或缩放副本后对其调用 Read 所有向多模态模型发送超大图片并触发预压缩的会话 原图路径仍保留在提示中,可配合外部工具裁剪后用 Read 读取
状态清单契约 packages/agent-core-v2/docs/state-manifest.d.ts 与 @moonshot-ai/agent-core-v2 内部导出 声明非持久化状态键 'media.registeredKey': string | undefined(persist: false);packages/agent-core-v2/src/index.ts 导出 READ_MEDIA_FILE_TOOL_NAME、IMediaToolsRegistrar、cropImageForModel 等符号 移除非持久化内存状态键 'media.registeredKey' 及上述已下线内部导出;公开 SDK @moonshot-ai/kimi-code-sdk(packages/node-sdk/src/index.ts)导出面保持不变(READ_IMAGE_BYTE_BUDGET、persistOriginalImage 原样保留) 旧版本写入的磁盘会话,以及直接深层引用 @moonshot-ai/agent-core-v2 内部包的工作区代码 'media.registeredKey' 从未落盘到 wire.jsonl,新版本读旧会话与回滚旧版本读新会话均完全兼容
ACP、Web/Desktop 与 TUI 工具调用展示 读取媒体时工具名为 ReadMediaFile;ACP 工具调用 kind 为 'other' 新会话读取媒体时工具名为 Read;ACP 工具调用 kind 归为 'read';Web/Desktop(READ_MEDIA_TOOL_RE)与 TUI 在 Read 返回媒体内容时渲染媒体卡片/摘要,同时保留 'ReadMediaFile' 分支以兼容旧会话回放 ACP 客户端(如 Zed)、Desktop/Web 用户、TUI 用户,以及回放历史会话的用户 旧会话中的 ReadMediaFile 卡片渲染完整保留

旧 ReadMediaFile 路径功能迁移核对清单

  • 环境变量 KIMI_IMAGE_READ_BYTE_BUDGET 与 KIMI_IMAGE_MAX_EDGE_PX:保留配置注入与 packages/agent-core-v2/src/agent/media/image-compress.ts 预算解析,由 ReadTool.readMedia(readTool.ts)原样调用 resolveReadImageByteBudget() 与 resolveMaxImageEdgePx()。
  • 文件大小上限(MAX_MEDIA_BYTES = 100MB)与解码保护上限(MAX_IMAGE_DECODE_BYTES):迁入 read.ts 与 ReadTool.readMedia,超限文案保持清晰说明。
  • daemon-file:// 会话附件读取与本地/远程工作区路径校验:复用 ReadTool 既有的 attachmentExecution、EnvironmentWorkspaceView、工作区边界检查与 Read(path) 审批规则匹配。
  • 图片重编码压缩、EXIF 旋转后尺寸计算与 image_compress(source: 'read_media')遥测:迁入 ReadTool.readMedia,行为与原 ReadMediaFileTool 一致。
  • ISessionMediaStore.put 写入与 AbortSignal 取消透传:在 ReadTool.readMedia 中将 signal 透传给 attachmentStore.put,确保中途取消(如大视频写入/上传)可及时中断。
  • 视频上传器 createVideoUploader 与 video_upload 遥测:从删除的 registerMediaTools.ts 迁至 packages/agent-core-v2/src/agent/media/videoUpload.ts,继续由 mediaResolverService.ts 调用。
  • 旧会话历史 ReadMediaFile 隐藏降级:保留在 packages/agent-core-v2/src/agent/loop/mediaPolicy.ts(hideReadMediaFile)。

受影响模块与验证结论

  • 受影响模块:@moonshot-ai/agent-core-v2、@moonshot-ai/app-core、@moonshot-ai/kimi-code(TUI)、@moonshot-ai/acp-server(测试适配)、@moonshot-ai/klient(测试适配)、用户文档 docs/{en,zh}。
  • 平台核对说明:已在 macOS(Darwin)与 Linux(node:24-bookworm)环境核对:本地文件读取、POSIX/Windows 路径规则单元测试(read.test.ts)、TUI 虚拟终端流测试(含视频上传中途取消恢复)、旧会话恢复与 compaction 提醒重注入测试,以及真实 released-2.6.3 会话子进程冷恢复测试;Windows 环境待本 PR 的 CI 工作流进一步验证。
  • 验证结论:pnpm lint、pnpm run check:duplication、agent-core-v2 / apps/kimi-code / apps/desktop(含 vue-tsc)/ acp-server 类型检查、媒体读取与压缩单测、旧会话恢复(含 Read schema 刷新、ReadMediaFile 过滤、legacy_read_media_merged 一次性迁移提醒与跨模态切换提醒)测试、ACP / klient / kap-server 集成测试及 released-2.6.3 冷恢复测试均已通过。
完整验证命令与测试文件清单
  • pnpm lint(macOS / Linux) — 通过(0 warnings, 0 errors)
  • pnpm run check:duplication 7f71717094b8ee1c8ee0b9a3eeffe6f9ba1746d7 — 通过
  • pnpm exec tsc -p packages/agent-core-v2/tsconfig.json --noEmit — 通过
  • pnpm exec vitest run --reporter=agent --maxWorkers=15 packages/agent-core-v2/test/wire/resume.test.ts packages/agent-core-v2/test/agent/toolSelect tests/scenarios/cold-recovery.test.ts(Linux) — 通过(5 files, 160 tests,含 released-2.6.3 真实旧版会话冷恢复;修复前对照新增的 2 条 legacy_read_media_merged 恢复提醒用例如期失败)

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue (external PRs: issue must have a maintainer's /approve).
  • I have added tests that prove my feature works.
  • The behavior-change table above is complete, and every removed behavior or flipped default is named in the changeset and either has an escape hatch or was explicitly approved by a maintainer in this PR.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot

changeset-bot Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2a37496

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
@moonshot-ai/kimi-code Minor
kimi-code-app Minor
@moonshot-ai/agent-core-v2 Minor
@moonshot-ai/acp-server Patch
@moonshot-ai/kap-server Patch
@moonshot-ai/klient Patch
@moonshot-ai/migration-legacy Patch
@moonshot-ai/kimi-code-product Patch
@moonshot-ai/remote-control Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@7Hanrui

7Hanrui commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-26T13:00:39.583513Z 2a37496 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3f52f0ae19

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +35 to +36
dispatcher.hooks.onDidRestore.register('media', async (_ctx, next) => {
this.captureBaseline();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve an undefined baseline after restoring media history

When an older session containing image or video parts is restored under a model that no longer supports that media type, this hook immediately records the current model as the baseline. Consequently, inject() sees previous equal to current and returns before reaching its unsupportedPriorMedia check, so the promised restore-time reminder is never emitted and the model is not told that earlier media was omitted or that it must not call Read for that type. Avoid capturing the baseline here, or retain enough pre-restore state to let the first post-restore injection inspect the restored history.

AGENTS.md reference: AGENTS.md:L191-L193

Useful? React with 👍 / 👎.

@7Hanrui

7Hanrui commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3c582db9ae

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +86 to +87
if (previous.imageIn === current.imageIn && previous.videoIn === current.videoIn) {
return undefined;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Re-inject the capability reminder after compaction

After a vision-to-text-only model switch followed by full compaction, the reminder framework re-runs this provider with no lastDisclosure, but baseline still equals the current text-only capabilities, so this equality check suppresses the reminder. The compacted context has therefore lost the warning while the frozen Read schema still advertises image and video support, allowing the model to call Read on media it cannot consume. Treat a compaction rearm as requiring disclosure again, as the legacy merge reminder already does.

AGENTS.md reference: AGENTS.md:L111-L115

Useful? React with 👍 / 👎.

@7Sageer
7Sageer marked this pull request as ready for review November 26, 2026 09:38

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 81fa9472f8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@@ -0,0 +1,5 @@
---
"@moonshot-ai/agent-core-v2": minor

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Mark the agent-core change as breaking

Consumers of @moonshot-ai/agent-core-v2 that still rely on ReadMediaFile or its region and full_resolution inputs lose that behavior after this release. The changeset explicitly removes them but classifies the package change as minor; mark it as breaking or preserve a compatibility path.

AGENTS.md reference: AGENTS.md:L90-L90

Useful? React with 👍 / 👎.

@pkg-pr-new

pkg-pr-new Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@2a37496
npx https://pkg.pr.new/@moonshot-ai/kimi-code@2a37496

commit: 2a37496

@7Hanrui

7Hanrui commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 2a37496b26

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants